import { notification } from 'antd';

import styles from './utils.less';

export const selectSearchConfig = {
  showSearch: true,
  filterOption: (input: any, option: any) =>
    String(option.children)?.toLowerCase().indexOf(input.toLowerCase()) >= 0,
};

// 打开在线试听播放器
export const openOnlineListenPlayer = (title: string, mediaUrl: string) => {
  notification.info({
    message: `在线试听(${title})`,
    description: (
      <audio
        src={mediaUrl}
        className={styles.audioPlayer}
        autoPlay
        controls
        controlsList="nodownload"
      ></audio>
    ),
    placement: 'bottomRight',
    duration: 0,
  });
};
